using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;

namespace BrianLyttle.Samples.WinForms
{
    public partial class CrashDialog : Form
    {
        private List<CrashDataItem> basicInfo;
        private string advInfo;

        public CrashDialog()
        { }

        public CrashDialog(string ApplicationTitle, List<CrashDataItem> BasicInfo, string AdvancedInfo)
        {
            InitializeComponent();
            
            basicInfo = BasicInfo;
            advInfo = AdvancedInfo;
            this.Text = ApplicationTitle + " has encountered an error";            
        }

        private void CrashDialog_Load(object sender, EventArgs e)
        {
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            Process.GetCurrentProcess().Kill();
        }

        private void cbPrivacyPolicy_CheckedChanged(object sender, EventArgs e)
        {
            if (cbPrivacyPolicy.Checked == true)
            {
                btnSendErrorReport.Enabled = true;
            }
            else
            {
                btnSendErrorReport.Enabled = false;
            }
        }

        private void btnSendErrorReport_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Transmit error report");
        }

        private void btnViewCrashDetails_Click(object sender, EventArgs e)
        {
            CrashDetailsDialog cdd = new CrashDetailsDialog(basicInfo, advInfo);
            cdd.Show();
        }
    }
}